home *** CD-ROM | disk | FTP | other *** search
- Path: news.uiowa.edu!usenet
- From: larued@crpl.cedar-rapids.lib.ia.us
- Newsgroups: comp.lang.c++
- Subject: Re: Compile problem
- Date: 1 Feb 1996 01:01:07 GMT
- Organization: University of Iowa, Iowa City, IA, USA
- Distribution: world
- Message-ID: <4ep3cj$nho@flood.weeg.uiowa.edu>
- References: <4eol9k$gqf@fred.uswnvg.com>
- Reply-To: larued@crpl.cedar-rapids.lib.ia.us
- NNTP-Posting-Host: ppp-109.cedar-rapids.lib.ia.us
- X-Newsreader: IBM NewsReader/2 v1.9d - NLS
-
- In <4eol9k$gqf@fred.uswnvg.com>, jweddle@uswnvg.com (Jacque Weddle) writes:
- >Hello,
- >
- >I'm a c person trying to compile some c++ code I got
- >off the net. I get the error message
- >
- >"Log.cc", line 261: error: jump past initializer (did you forget a '{ }'?)
- >
- >I don't see a problem at the designated line number. Whats an
- >initializer?
- >I know this isn't much information but if someone could please
- >tell me what kind of thing I should look for to fix this I'd much
- >appreciate it.
- >
- >TIA,
- >Jacque
- >
-
- Jacque,
-
- Code would have helped. However, I've recently seen the problem.
-
- The problem is creating and initializing objects inside branch logic.
-
- For instance, creating objects inside a switch statement will cause this
- error.
-
-
- ===== Example code fragment
- ...
-
- switch (X)
- {
- case 0 : Y = 0; break;
- case 1 : int K; break; // K is an object that can skip being initialized
- default: Z = 0; break;
- }
-
- // K's scope is the entire fragment; not just the switch's {}. If two K's were
- // declared (say case 0 and case 1) a duplicate define error would occur.
-
- =====
-
-
- Hope this helps,
-
- Dave
-